package com.nd.test.controller;

import java.util.List;
import java.util.Date;

import model.po.CouponsModel;
import com.nd.test.vo.CouponsModelVo;
import com.nd.test.repository.CouponsModelRepository;
import com.nd.test.service.CouponsModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**   
 * Create by apisdk 
 */
@RestController
@RequestMapping(value="/couponsModel")
public class CouponsModelController {
	@Autowired
	private CouponsModelRepository couponsModelRepository;

	@Autowired
	private CouponsModelService couponsModelService;

	/**
	* @description create model
	* @return
	*/
	@RequestMapping(value= "", method = RequestMethod.POST)
	public CouponsModelVo createCouponsModel(@RequestBody CouponsModelVo couponsModelVo) throws Exception {
		return couponsModelService.createCouponsModel(couponsModelVo);
	}

	/**
	* @description get model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.GET)
	public CouponsModelVo getCouponsModelById(@PathVariable String id){
		return couponsModelService.getCouponsModelById(id);
	}

	/**
	* @description update model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.PUT)
	public CouponsModelVo updateCouponsModelById(@PathVariable String id,@RequestBody CouponsModelVo couponsModelVo){
		return couponsModelService.updateCouponsModelById(id,couponsModelVo);
	}

	/**
	* @description delete model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.DELETE)
	public void deleteCouponsModelById(@PathVariable String id){
		couponsModelService.deleteCouponsModelById(id);
		return;
	}

}
